AGC025D Choosing Points 解题报告 发布于 2021-03-04 | 5分钟 | 881字数 Description 给定 n,d1,d2n, d_1, d_2n,d1,d2 ,请在 2n×2n2n\times 2n2n×2n 的网格中找到 n2n^2n2 个点,满足任意两点间的距离既不为 d1\sqrt{d_1}d1 { const dist = Math.ceil(needScrollTop / 10) _currentY += dist window.scrollTo(_currentY, currentY) if (needScrollTop > 10 || needScrollTop < -10) { scrollAnimation(_currentY, targetY) } else { window.scrollTo(_currentY, targetY) } }, 1) } back2Top.addEventListener("click", function (e) { scrollAnimation(document.scrollingElement.scrollTop, 0); e.stopPropagation(); return false; }); window.addEventListener('scroll', function (e) { let percent = document.scrollingElement.scrollTop / (document.scrollingElement.scrollHeight - document.scrollingElement.clientHeight) * 100; if (percent > 1 && !back2Top.classList.contains('back-top-active')) { back2Top.classList.add('back-top-active'); } if (percent == 0) { back2Top.classList.remove('back-top-active'); } if (back2TopText) { back2TopText.textContent = Math.floor(percent); } }); let hasCacu = false; window.onresize = function () { calcuHeight(); } function calcuHeight() { // 动态调整站点概览高度 if (!hasCacu && back2Top.classList.contains('pisces') || back2Top.classList.contains('gemini')) { let sideBar = document.querySelector('.sidebar'); let navUl = document.querySelector('#site_nav'); sideBar.style = 'margin-top:' + (navUl.offsetHeight + navUl.offsetTop + 15) + 'px;'; hasCacu = true; } } calcuHeight(); let open = false, MOTION_TIME = 300, RIGHT_MOVE_DIS = '320px'; if (drawerBox) { let rightMotions = document.querySelectorAll('.right-motion'); let right = drawerBox.classList.contains('right'); let transitionDir = right ? "transition.slideRightIn" : "transition.slideLeftIn"; let openProp, closeProp; if (right) { openProp = { paddingRight: RIGHT_MOVE_DIS }; closeProp = { paddingRight: '0px' }; } else { openProp = { paddingLeft: RIGHT_MOVE_DIS }; closeProp = { paddingLeft: '0px' }; } drawerBox.onclick = function () { open = !open; window.Velocity(rightSideBar, 'stop'); window.Velocity(viewport, 'stop'); window.Velocity(rightMotions, 'stop'); if (open) { window.Velocity(rightSideBar, { width: RIGHT_MOVE_DIS }, { duration: MOTION_TIME, begin: function () { window.Velocity(rightMotions, transitionDir, {}); } }) window.Velocity(viewport, openProp, { duration: MOTION_TIME }); } else { window.Velocity(rightSideBar, { width: '0px' }, { duration: MOTION_TIME, begin: function () { window.Velocity(rightMotions, { opacity: 0 }); } }) window.Velocity(viewport, closeProp, { duration: MOTION_TIME }); } for (let i = 0; i < drawerBox.children.length; i++) { drawerBox.children[i].classList.toggle('muse-line'); } drawerBox.classList.toggle(sideBarOpen); } } // 链接跳转 let newWindow = 'false' if (newWindow === 'true') { let links = document.querySelectorAll('.post-body a') links.forEach(item => { if (!item.classList.contains('btn')) { item.setAttribute("target", "_blank"); } }) } let faSearch = document.querySelector('#fa_search'); faSearch.addEventListener('click', function () { document.querySelector('#search_mask').style = '' }) // 代码高亮 hljs.initHighlightingOnLoad(); // 离开当前页title变化 var leaveTitle = ""; if (leaveTitle) { document.addEventListener('visibilitychange', function () { if (document.visibilityState == 'hidden') { normal_title = document.title; document.title = leaveTitle; } else { document.title = normal_title; } }); }